Skip to content

Instantly share code, notes, and snippets.

Useful Sim4Life API snippets

Practical code examples for common Sim4Life Python API tasks, extracted from real-world usage. Organized by functionality.

Dictionary-like access patterns

Many Sim4Life API objects behave like dictionaries and can be accessed directly by name or key, not just iterated. For example:

# Direct access by name

LLM Wiki

A pattern for building personal knowledge bases using LLMs.

This is an idea file, it is designed to be copy pasted to your own LLM Agent (e.g. OpenAI Codex, Claude Code, OpenCode / Pi, or etc.). Its goal is to communicate the high level idea, but your agent will build out the specifics in collaboration with you.

The core idea

Most people's experience with LLMs and documents looks like RAG: you upload a collection of files, the LLM retrieves relevant chunks at query time, and generates an answer. This works, but the LLM is rediscovering knowledge from scratch on every question. There's no accumulation. Ask a subtle question that requires synthesizing five documents, and the LLM has to find and piece together the relevant fragments every time. Nothing is built up. NotebookLM, ChatGPT file uploads, and most RAG systems work this way.

@paulhayes
paulhayes / Sun.cs
Last active April 21, 2026 11:47
Rotates a Unity directional light based on location and time. Includes time scale, and frame stepping for continuous use.
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Entropedia
{
[RequireComponent(typeof(Light))]
[ExecuteInEditMode]
@jerryan999
jerryan999 / find_empty.go
Last active April 21, 2026 11:46
Solve Sudoku in Golang
func findNextEmpty(board [][]byte) (byte, byte, error) {
for j := byte(0); j < 9; j++ {
for i := byte(0); i < 9; i++ {
if board[j][i] == '.' {
return j, i, nil
}
}
}
return byte(0), byte(0), errors.New("no empty cell to fill in")
}
import 'package:flutter/material.dart';
import 'dart:math' as math;
import 'dart:async';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
@unixzii
unixzii / skill-extract-car-images.md
Created April 21, 2026 11:07
Use this skill when you need to build or explain a macOS-only tool that extracts image assets from an Apple asset catalog `.car` file.
name extract-car-images
description Use this skill when you need to build or explain a macOS-only tool that extracts image assets from an Apple asset catalog `.car` file.
version 1.0.0

Extract CAR Images

Use this skill when the user needs the core capability of exporting all image resources from an Apple .car asset catalog. The intended environment is macOS with Objective-C tooling available. This skill is about reproducing the capability, not reproducing any specific project structure.

@mkweskin
mkweskin / find.md
Last active April 21, 2026 11:43
Linux `find` basics

Linux find

find is used to find files based on their name or other attributes of the file.

  • It does not search inside files like the grep command
  • To find find examples for a speicific purpose, I do a web search for: linux find ...

Basic find command: search for a filename

find /path/to/dir -iname '*text*'

Dissecting this:

  • /path/to/dir: where you want to search, I often use . for my current directory
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp